Celltype - consensus time group specific markers in WT ground tissue

In [1]:
rm(list=ls())
# Set the working directory to where folders named after the samples are located. 
# The folder contains spliced.mtx, unspliced.mtx, barcodes and gene id files, and json files produced by scKB that documents the sequencing stats. 
setwd("/scratch/AG_Ohler/CheWei/scKB")
In [1]:
library(tidyverse)
library(Seurat)
library(RColorBrewer)
library(future)
library(cowplot)
library(ComplexHeatmap)
library(circlize)
library(ggrepel)
#for 200gb ram 
options(future.globals.maxSize = 200000 * 1024^2)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──

✔ ggplot2 3.3.0     ✔ purrr   0.3.3
✔ tibble  3.0.1     ✔ dplyr   0.8.5
✔ tidyr   1.0.2     ✔ stringr 1.4.0
✔ readr   1.3.1     ✔ forcats 0.5.0

── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()


********************************************************

Note: As of version 1.0.0, cowplot does not change the

  default ggplot2 theme anymore. To recover the previous

  behavior, execute:
  theme_set(theme_cowplot())

********************************************************


Loading required package: grid

========================================
ComplexHeatmap version 2.2.0
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.
========================================


========================================
circlize version 0.4.8
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: http://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization 
  in R. Bioinformatics 2014.
========================================


In [2]:
rc.integrated <- readRDS("./supp_data/Ground_Tissue_Atlas.rds")
In [3]:
table(rc.integrated$celltype.anno)
Putative Quiescent Center           Stem Cell Niche                 Columella 
                     1195                      1807                         0 
         Lateral Root Cap              Atrichoblast               Trichoblast 
                        0                         0                         0 
                   Cortex                Endodermis                 Pericycle 
                    10206                     10479                         0 
                   Phloem                     Xylem                Procambium 
                        0                         0                         0 
In [4]:
# Simple QC label
rc.integrated$celltype.anno <- gsub("Putative Quiescent Center", "Quiescent Center", rc.integrated$celltype.anno, ignore.case = FALSE, perl = FALSE,
     fixed = T, useBytes = FALSE)

order <- c("Quiescent Center", "Stem Cell Niche", "Columella", "Lateral Root Cap", "Atrichoblast", "Trichoblast", "Cortex", "Endodermis", "Pericycle", "Phloem", "Xylem", "Procambium", "Unknown")
palette <- c("#BD53FF", "#DED3FE", "#5AB953", "#BFEF45", "#008080", "#21B6A8", "#82B6FF", "#0000FF","#FF9900","#E6194B", "#9A6324", "#FFE119","#EEEEEE")
rc.integrated$celltype.anno <- factor(rc.integrated$celltype.anno, levels = order[sort(match(unique(rc.integrated$celltype.anno),order))])
color <- palette[sort(match(unique(rc.integrated$celltype.anno),order))]
In [5]:
options(repr.plot.width=8, repr.plot.height=6)
DimPlot(rc.integrated, reduction = "umap", group.by = "celltype.anno", cols=color)
In [6]:
options(repr.plot.width=8, repr.plot.height=6)
time_plt <- DimPlot(rc.integrated, 
        group.by = "time.anno", 
        order = c("Maturation","Elongation","Meristem"),
        cols = c("#DCEDC8", "#42B3D5", "#1A237E"))
time_plt
In [7]:
table(rc.integrated$consensus.time.group)
  T0   T1   T2   T3   T4   T5   T6   T7   T8   T9 
2616  691 2025 3073 2884 2248 1986 2308 2706 3150 
In [8]:
options(repr.plot.width=8, repr.plot.height=6)
DimPlot(rc.integrated, reduction = "umap", group.by = "consensus.time.group", cols=brewer.pal(10,"Spectral"))
In [9]:
# FindMarkers for celltype and time combination

rc.integrated$cell_group <- paste(rc.integrated$celltype.anno, rc.integrated$consensus.time.group, sep="_")
In [10]:
table(rc.integrated$cell_group)
          Cortex_T0           Cortex_T1           Cortex_T2           Cortex_T3 
                 11                 154                 664                1391 
          Cortex_T4           Cortex_T5           Cortex_T6           Cortex_T7 
               1272                1136                1106                1401 
          Cortex_T8           Cortex_T9       Endodermis_T0       Endodermis_T1 
               1670                1401                   6                 173 
      Endodermis_T2       Endodermis_T3       Endodermis_T4       Endodermis_T5 
               1333                1673                1611                1112 
      Endodermis_T6       Endodermis_T7       Endodermis_T8       Endodermis_T9 
                880                 906                1036                1749 
Quiescent Center_T0 Quiescent Center_T1 Quiescent Center_T2 Quiescent Center_T3 
               1070                 109                   9                   6 
Quiescent Center_T4  Stem Cell Niche_T0  Stem Cell Niche_T1  Stem Cell Niche_T2 
                  1                1529                 255                  19 
 Stem Cell Niche_T3  Stem Cell Niche_T7 
                  3                   1 
In [11]:
table(rc.integrated$celltype.anno, rc.integrated$consensus.time.group)
                  
                     T0   T1   T2   T3   T4   T5   T6   T7   T8   T9
  Quiescent Center 1070  109    9    6    1    0    0    0    0    0
  Stem Cell Niche  1529  255   19    3    0    0    0    1    0    0
  Cortex             11  154  664 1391 1272 1136 1106 1401 1670 1401
  Endodermis          6  173 1333 1673 1611 1112  880  906 1036 1749
In [12]:
Idents(rc.integrated) <- "cell_group"
In [13]:
Clust_Markers <- FindAllMarkers(rc.integrated,
                                max.cells.per.ident = 5000,
                                only.pos=T, 
                               test.use="roc")
Calculating cluster Cortex_T6

Calculating cluster Endodermis_T4

Calculating cluster Quiescent Center_T0

Calculating cluster Endodermis_T5

Calculating cluster Cortex_T7

Calculating cluster Cortex_T9

Calculating cluster Endodermis_T1

Calculating cluster Cortex_T4

Calculating cluster Endodermis_T2

Calculating cluster Endodermis_T8

Calculating cluster Cortex_T5

Calculating cluster Endodermis_T7

Calculating cluster Stem Cell Niche_T1

Calculating cluster Cortex_T8

Calculating cluster Endodermis_T9

Calculating cluster Endodermis_T6

Calculating cluster Cortex_T1

Calculating cluster Stem Cell Niche_T0

Calculating cluster Cortex_T3

Calculating cluster Cortex_T2

Calculating cluster Endodermis_T3

Calculating cluster Quiescent Center_T2

Calculating cluster Quiescent Center_T1

Calculating cluster Cortex_T0

Calculating cluster Endodermis_T0

Calculating cluster Quiescent Center_T3

Calculating cluster Stem Cell Niche_T2

Calculating cluster Stem Cell Niche_T3

Calculating cluster Quiescent Center_T4

Calculating cluster Stem Cell Niche_T7

In [14]:
feature_names <- read_tsv("./supp_data/features.tsv.gz", col_names = c("gene", "Name", "Type")) %>%
  select(-Type) %>%
  distinct()
Parsed with column specification:
cols(
  gene = col_character(),
  Name = col_character(),
  Type = col_character()
)

In [15]:
Clust_Markers <- left_join(Clust_Markers, feature_names)
Joining, by = "gene"

In [16]:
Clust_Markers %>% group_by(cluster) %>% tally()
A tibble: 28 × 2
clustern
<fct><int>
Cortex_T6 197
Endodermis_T4 342
Quiescent Center_T02974
Endodermis_T5 246
Cortex_T7 206
Cortex_T9 477
Endodermis_T1 838
Cortex_T4 506
Endodermis_T2 655
Endodermis_T8 655
Cortex_T5 417
Endodermis_T7 338
Stem Cell Niche_T1 2308
Cortex_T8 392
Endodermis_T9 824
Endodermis_T6 176
Cortex_T1 893
Stem Cell Niche_T0 2342
Cortex_T3 587
Cortex_T2 602
Endodermis_T3 475
Quiescent Center_T2 693
Quiescent Center_T12494
Cortex_T0 730
Endodermis_T0 556
Quiescent Center_T3 484
Stem Cell Niche_T2 543
Stem Cell Niche_T3 321
In [17]:
Clust_Markers %>% group_by(cluster) %>% top_n(1, myAUC)
A grouped_df: 33 × 8
myAUCavg_diffpowerpct.1pct.2clustergeneName
<dbl><dbl><dbl><dbl><dbl><fct><chr><chr>
0.8561.2050160.7120.8800.260Cortex_T6 AT1G53830PME2
0.9052.0650410.8100.9620.266Endodermis_T4 AT5G13910LEP
0.9704.1276200.9400.9470.076Quiescent Center_T0AT2G28900OEP161
0.8841.8900560.7680.9790.353Endodermis_T5 AT4G16447AT4G16447
0.8541.4687300.7080.9440.335Cortex_T7 AT1G62510AT1G62510
0.9592.6683010.9180.9960.180Cortex_T9 AT5G15180PER56
0.9323.0493820.8640.9250.157Endodermis_T1 AT5G07030AT5G07030
0.8941.9113770.7880.9670.284Cortex_T4 AT5G11420AT5G11420
0.9152.3173230.8300.9840.365Endodermis_T2 AT1G11580ATPMEPCRA
0.9231.9703030.8460.9900.220Endodermis_T8 AT2G36100CASP1
0.8771.7720210.7540.9450.289Cortex_T5 AT5G11420AT5G11420
0.8771.7142000.7540.9390.222Endodermis_T7 AT5G66390PER72
0.9563.4265990.9120.9760.176Stem Cell Niche_T1 AT3G09200RPP0B
0.9242.0575100.8480.9550.173Cortex_T8 AT5G15180PER56
0.9703.2644610.9400.9830.124Endodermis_T9 AT2G39430DIR9
0.8791.3930070.7580.9950.470Endodermis_T6 AT1G02900RALF1
0.9633.4891080.9260.9810.214Cortex_T1 AT2G45050GATA2
0.9682.9619160.9360.9970.129Stem Cell Niche_T0 AT3G09200RPP0B
0.9682.8883770.9361.0000.118Stem Cell Niche_T0 AT5G16130RPS7C
0.9682.7886250.9360.9940.124Stem Cell Niche_T0 AT2G39460RPL23AA
0.9682.7265300.9360.9950.119Stem Cell Niche_T0 AT2G47610RPL7AA
0.9001.8811750.8000.8950.192Cortex_T3 AT4G15160AT4G15160
0.8822.1546040.7640.9160.319Cortex_T2 AT5G62210AT5G62210
0.9142.1057010.8280.9160.208Endodermis_T3 AT1G62480AT1G62480
0.9581.8372650.9160.3330.013Quiescent Center_T2AT2G21045HAC1
0.9483.1279190.8960.9820.173Quiescent Center_T1AT4G27090RPL14B
0.9482.5300510.8960.9910.185Quiescent Center_T1AT2G36160RPS14A
0.9482.2767800.8960.9910.203Quiescent Center_T1AT3G11940RPS5B
0.9823.9995490.9641.0000.296Cortex_T0 AT1G17285AT1G17285
0.9893.8438610.9781.0000.191Endodermis_T0 AT1G46264HSFB4
0.9711.5784380.9421.0000.101Quiescent Center_T3AT2G27660AT2G27660
0.9151.5261140.8301.0000.194Stem Cell Niche_T2 AT3G49910RPL26A
0.9801.9804350.9600.6670.015Stem Cell Niche_T3 AT1G23540PERK12
In [18]:
Clust_Markers <- separate(Clust_Markers, cluster, into=c("celltype", "stage"), sep="_", remove=F)
In [19]:
Clust_Markers <- mutate(Clust_Markers, pct.diff=pct.1-pct.2)

Clust_Markers <- arrange(Clust_Markers, desc(pct.diff)) %>%
group_by(cluster) %>%
mutate(pct.diff_rank=dplyr::row_number()) %>%
arrange(desc(avg_diff)) %>%
mutate(avg_diff_rank=dplyr::row_number()) %>%
arrange(desc(myAUC)) %>%
mutate(myAUC_rank=dplyr::row_number()) %>%
mutate(combined_rank_raw=(pct.diff_rank + avg_diff_rank + myAUC_rank)/3) %>%
arrange(combined_rank_raw) %>%
mutate(combined_rank=dplyr::row_number()) %>%
select(-combined_rank_raw) %>%
arrange(combined_rank)
Clust_Markers
A grouped_df: 22271 × 15
myAUCavg_diffpowerpct.1pct.2clustercelltypestagegeneNamepct.diffpct.diff_rankavg_diff_rankmyAUC_rankcombined_rank
<dbl><dbl><dbl><dbl><dbl><fct><chr><chr><chr><chr><dbl><int><int><int><int>
0.9052.0650410.8100.9620.266Endodermis_T4 Endodermis T4AT5G13910LEP 0.696 2 2 11
0.9633.4891080.9260.9810.214Cortex_T1 Cortex T1AT2G45050GATA2 0.767 3 5 11
0.9142.1057010.8280.9160.208Endodermis_T3 Endodermis T3AT1G62480AT1G624800.708 1 8 11
0.9323.0493820.8640.9250.157Endodermis_T1 Endodermis T1AT5G07030AT5G070300.768 2 10 11
0.8772.0066300.7540.9390.270Cortex_T4 Cortex T4AT1G41830SKS6 0.669 2 11 31
0.8975.5460180.7940.9470.208Stem Cell Niche_T2 Stem Cell Niche T2AT1G56070LOS1 0.73910 3 51
0.9714.6290080.9421.0000.123Endodermis_T0 Endodermis T0AT4G29050AT4G290500.877 1 6131
0.8882.4255910.7760.8870.164Endodermis_T2 Endodermis T2AT3G23730XTH16 0.723 1 15 41
0.8551.9278370.7100.9100.270Endodermis_T5 Endodermis T5AT2G23560MES7 0.640 2 12 61
0.8531.4809190.7060.9420.339Cortex_T6 Cortex T6AT2G39010PIP2-6 0.603 2 16 21
0.8701.8409860.7400.9130.276Cortex_T5 Cortex T5AT1G41830SKS6 0.637 2 18 31
0.8281.9280550.6560.7620.204Cortex_T7 Cortex T7AT3G18200AT3G182000.558 9 5 91
0.8252.0488600.6500.7700.201Endodermis_T6 Endodermis T6AT4G15960AT4G159600.569 7 9 81
0.9313.0832620.8620.9350.172Cortex_T9 Cortex T9AT5G44480DUR 0.763 4 15 61
0.9704.3185000.9401.0000.128Cortex_T0 Cortex T0AT4G21960PER42 0.872 1 17111
0.9704.1276200.9400.9470.076Quiescent Center_T0Quiescent CenterT0AT2G28900OEP161 0.87120 9 11
0.8702.1440050.7400.9140.299Cortex_T3 Cortex T3AT5G62210AT5G622100.615 9 12111
0.9585.9591160.9161.0000.233Stem Cell Niche_T3 Stem Cell Niche T3AT4G31890AT4G318900.76715 11 71
0.8662.4431800.7320.8480.254Cortex_T2 Cortex T2AT5G14020AT5G140200.594 7 28 31
0.9694.5105910.9380.9720.270Endodermis_T9 Endodermis T9AT1G02500SAM1 0.70246 1 21
0.9545.5965750.9080.8330.058Quiescent Center_T3Quiescent CenterT3AT4G25170AT4G251700.77515 23121
0.8952.1564380.7900.8110.157Cortex_T8 Cortex T8AT1G14870PCR2 0.654 7 38 61
0.8711.7409780.7420.9370.227Endodermis_T7 Endodermis T7AT2G36100CASP1 0.710 2 50 31
0.8422.5773150.6840.6820.140Endodermis_T8 Endodermis T8AT1G03850AT1G038500.54235 16201
0.9553.5174420.9100.9880.162Stem Cell Niche_T1 Stem Cell Niche T1AT2G19730RPL28A 0.826 9 82 21
0.9044.9951430.8080.8890.232Quiescent Center_T2Quiescent CenterT2AT1G30230AT1G302300.65721 55211
0.9443.3122690.8880.9720.174Quiescent Center_T1Quiescent CenterT1AT5G15200RPS9B 0.79815101 51
0.9663.0744980.9320.9970.119Stem Cell Niche_T0 Stem Cell Niche T0AT4G18100RPL32A 0.87836 90121
0.8902.1501640.7800.8770.222Endodermis_T3 Endodermis T3AT3G52920AT3G529200.655 8 3 52
0.9583.2670700.9160.9940.244Cortex_T1 Cortex T1AT3G60530GATA4 0.750 6 13 22
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
0.7090.43988410.4180.6360.287Quiescent Center_T0Quiescent CenterT0AT5G13970AT5G13970 0.3492843289028082945
0.2930.85832740.4140.1160.383Quiescent Center_T0Quiescent CenterT0AT3G05770AT3G05770-0.2672967262729522946
0.7160.34642740.4320.4800.222Quiescent Center_T0Quiescent CenterT0AT2G31390AT2G31390 0.2582924293026942947
0.7120.36794750.4240.6230.296Quiescent Center_T0Quiescent CenterT0AT1G12520CCS 0.3272876292227582948
0.7090.29236280.4180.6260.265Quiescent Center_T0Quiescent CenterT0AT4G38570PIS2 0.3612815295528102949
0.7100.50918970.4200.1490.062Quiescent Center_T0Quiescent CenterT0AT1G23750AT1G23750 0.0872944285527892950
0.7020.44291520.4040.6410.269Quiescent Center_T0Quiescent CenterT0AT1G52370AT1G52370 0.3722780288929282951
0.7040.29674550.4080.6810.303Quiescent Center_T0Quiescent CenterT0AT2G39440AT2G39440 0.3782762295028912952
0.7030.63569330.4060.4640.189Quiescent Center_T0Quiescent CenterT0AT5G50180AT5G50180 0.2752917278229072953
0.7030.25118030.4060.5220.137Quiescent Center_T0Quiescent CenterT0AT4G28400AT4G28400 0.3852743297329092954
0.7070.47447630.4140.5840.295Quiescent Center_T0Quiescent CenterT0AT1G65220AT1G65220 0.2892910287028462955
0.2780.74115960.4440.0810.253Quiescent Center_T0Quiescent CenterT0AT5G03180AT5G03180-0.1722951271629602956
0.2930.69143920.4140.0790.216Quiescent Center_T0Quiescent CenterT0AT2G25565AT2G25565-0.1372948274829532957
0.7060.27356270.4120.6640.321Quiescent Center_T0Quiescent CenterT0AT1G09150AT1G09150 0.3432850296428722958
0.7030.36239660.4060.5590.218Quiescent Center_T0Quiescent CenterT0AT1G16916AT1G16916 0.3412854292729082959
0.7070.36636190.4140.5360.266Quiescent Center_T0Quiescent CenterT0AT5G45750RABA1C 0.2702921292528472960
0.2800.61869780.4400.0700.305Quiescent Center_T0Quiescent CenterT0AT2G31590AT2G31590-0.2352961279129592961
0.2640.62419450.4720.0090.199Quiescent Center_T0Quiescent CenterT0AT4G31441AT4G31441-0.1902954279029682962
0.2940.55979000.4120.1250.278Quiescent Center_T0Quiescent CenterT0AT3G15340PPI2 -0.1532949282629502963
0.2100.54833610.5800.1000.524Quiescent Center_T0Quiescent CenterT0AT2G47890COL13 -0.4242973283229732964
0.2440.52813440.5120.0210.300Quiescent Center_T0Quiescent CenterT0AT3G10450SCPL7 -0.2792969283929712965
0.2780.50255060.4440.0470.321Quiescent Center_T0Quiescent CenterT0AT1G63390AT1G63390-0.2742968285929612966
0.2760.47691850.4480.1270.356Quiescent Center_T0Quiescent CenterT0AT1G01670PUB56 -0.2292960286729622967
0.2720.47285220.4560.1710.428Quiescent Center_T0Quiescent CenterT0AT3G48115AT3G48115-0.2572964287429652968
0.2900.44951960.4200.1960.481Quiescent Center_T0Quiescent CenterT0AT2G45160SCL27 -0.2852970288129572969
0.2940.38653480.4120.0190.191Quiescent Center_T0Quiescent CenterT0AT3G07730AT3G07730-0.1722953291329512970
0.2190.44723110.5620.1000.464Quiescent Center_T0Quiescent CenterT0AT5G37740AT5G37740-0.3642972288529722971
0.2950.37097540.4100.0720.310Quiescent Center_T0Quiescent CenterT0AT5G02645AT5G02645-0.2382962292129492972
0.2920.32141300.4160.0720.206Quiescent Center_T0Quiescent CenterT0AT5G02440AT5G02440-0.1342947294029542973
0.2920.25048670.4160.1440.455Quiescent Center_T0Quiescent CenterT0AT2G28320AT2G28320-0.3112971297429552974
In [20]:
filter(Clust_Markers, celltype %in% c("Cortex", "Endodermis") & myAUC>=0.75) %>%
group_by(celltype) %>% 
tally()
A tibble: 2 × 2
celltypen
<chr><int>
Cortex 2740
Endodermis2773
In [21]:
filter(Clust_Markers, celltype %in% c("Cortex", "Endodermis") & myAUC>=0.75) %>%
group_by(cluster) %>% 
tally()
A tibble: 20 × 2
clustern
<fct><int>
Cortex_T6 76
Endodermis_T4184
Endodermis_T5121
Cortex_T7 84
Cortex_T9 271
Endodermis_T1493
Cortex_T4 249
Endodermis_T2337
Endodermis_T8285
Cortex_T5 188
Endodermis_T7 77
Cortex_T8 186
Endodermis_T9448
Endodermis_T6 69
Cortex_T1 601
Cortex_T3 281
Cortex_T2 253
Endodermis_T3253
Cortex_T0 551
Endodermis_T0506
In [22]:
table(Clust_Markers$stage)
  T0   T1   T2   T3   T4   T5   T6   T7   T8   T9 
6602 6533 2493 1867  848  663  373  544 1047 1301 
In [23]:
Clust_Markers$stage <- factor(Clust_Markers$stage, levels=c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"))
In [24]:
# write markers with AUC 0.75 and above to a csv
# "Cortex", "Endodermis"

Clust_Markers_to_write <- filter(Clust_Markers, celltype %in% c("Cortex", "Endodermis") & myAUC>=0.75) %>% arrange(celltype) %>% arrange(stage) %>% arrange(combined_rank)

write.csv(Clust_Markers_to_write, "./docs/WT_Endodermis_Cortex_markers_AUC_0.75.csv", row.names=F)
In [25]:
number_de_genes <- filter(Clust_Markers, celltype %in% c("Cortex", "Endodermis") & myAUC>=0.75) %>%
group_by(cluster) %>% 
tally() %>%
separate(cluster, into=c("celltype", "stage"), sep="_")
In [26]:
number_de_genes$stage <- factor(number_de_genes$stage, levels=c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"))

(number_de_genes <- arrange(number_de_genes, celltype) %>% arrange(stage) %>% rename("n_de_genes"=n))

write.csv(number_de_genes, "./docs/WT_Endodermis_Cortex_markers_AUC_0.75_n_DE.csv", row.names=F)
A tibble: 20 × 3
celltypestagen_de_genes
<chr><fct><int>
Cortex T0551
EndodermisT0506
Cortex T1601
EndodermisT1493
Cortex T2253
EndodermisT2337
Cortex T3281
EndodermisT3253
Cortex T4249
EndodermisT4184
Cortex T5188
EndodermisT5121
Cortex T6 76
EndodermisT6 69
Cortex T7 84
EndodermisT7 77
Cortex T8186
EndodermisT8285
Cortex T9271
EndodermisT9448
In [20]:
table(Clust_Markers$stage)
  T0   T1   T2   T3   T4   T5   T6   T7   T8   T9 
6602 6533 2493 1867  848  663  373  544 1047 1301 
In [21]:
Clust_Markers$stage <- factor(Clust_Markers$stage, levels=c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"))
In [22]:
rc.integrated$consensus.time.group <- factor(rc.integrated$consensus.time.group, levels=c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"))
In [23]:
Idents(rc.integrated) <- "consensus.time.group"
In [24]:
# pseudobulk of each stage

  afm <- as.matrix(rc.integrated@assays$integrated@data)
  pooled <- matrix(nrow=nrow(afm), ncol = 0)

  for (i in unique(rc.integrated@meta.data$consensus.time.group)) {
    m <- afm[,which(rc.integrated@meta.data$consensus.time.group==i)]
    pooled <- cbind(pooled, rowSums(m)/ncol(m))
  }
In [25]:
unique(rc.integrated@meta.data$consensus.time.group)
  1. T6
  2. T4
  3. T0
  4. T5
  5. T7
  6. T9
  7. T1
  8. T2
  9. T8
  10. T3
Levels:
  1. 'T0'
  2. 'T1'
  3. 'T2'
  4. 'T3'
  5. 'T4'
  6. 'T5'
  7. 'T6'
  8. 'T7'
  9. 'T8'
  10. 'T9'
In [26]:
colnames(pooled) <- unique(rc.integrated@meta.data$consensus.time.group)
In [27]:
pooled_df <- as_tibble(pooled, rownames = "gene")
In [28]:
pooled_df_long <- pivot_longer(pooled_df, cols = 2:ncol(pooled_df), names_to = "stage", values_to = "expression")
In [29]:
long_order <- tibble(stage=paste("T", rep(0:9), sep=""), 
                     order=rep(1:10))
In [30]:
long_order
A tibble: 10 × 2
stageorder
<chr><int>
T0 1
T1 2
T2 3
T3 4
T4 5
T5 6
T6 7
T7 8
T8 9
T910
In [31]:
(pooled_df_long <- left_join(pooled_df_long, long_order) %>%
arrange(order))
Joining, by = "stage"

A tibble: 175130 × 4
genestageexpressionorder
<chr><chr><dbl><int>
AT1G05260T0-1.35167261
AT3G59370T0-2.15137581
AT2G36100T0-0.63837631
AT1G12080T0-2.49769001
AT1G12090T0-1.61717991
AT4G11290T0-1.33161021
AT5G42180T0-0.62866451
AT5G66390T0-0.78788781
AT2G32300T0-1.20410231
AT2G02130T0-2.31999301
AT3G11550T0-0.49642361
AT4G35350T0-0.57896691
AT1G30750T0-0.37385431
AT4G40090T0-0.95990671
AT1G20850T0-0.59483541
AT2G39430T0-0.42484591
AT1G75750T0-4.22722391
AT4G13580T0-0.50168611
AT4G25820T0-0.77242421
AT4G23690T0-1.45741341
AT1G26820T0-0.65748671
AT5G64100T0-2.26739611
AT1G65310T0-1.04704871
AT2G40113T0-0.39173061
AT5G17820T0-2.45716231
AT3G24020T0-0.45732141
AT5G04200T0-0.62870781
AT3G54580T0-1.19906051
AT3G09925T0-1.07566981
AT5G46900T0-2.83118161
⋮⋮⋮⋮
AT4G22220T9-0.0907664110
AT2G23090T9 0.0741178010
AT2G46490T9-0.4030605010
AT3G27240T9 0.4580462710
AT1G07140T9 0.0232015510
AT1G76200T9 0.4290114010
AT5G08670T9 0.3172844810
AT1G04357T9-0.0274950110
AT1G64230T9 0.1356091110
AT2G02050T9 0.3046970310
AT3G09840T9 0.3822333010
AT5G47030T9 0.1372630610
AT1G10590T9-0.3274218610
AT1G08480T9 0.2959985110
AT5G61330T9 0.0297926010
AT4G02580T9-0.0272667110
AT5G08060T9 0.4358835210
AT1G75950T9-0.2218126710
AT2G20360T9 0.3588552610
AT4G30010T9 0.3350593410
AT4G06395T9-0.0434014610
AT3G55440T9 0.1271603110
AT3G03100T9 0.4447506410
AT5G54760T9-0.0922013310
AT2G33040T9 0.3402451210
AT2G42680T9 0.0553335510
AT5G11770T9 0.4194712310
AT5G08290T9-0.0303622610
AT5G53300T9 0.0750379410
AT5G64400T9 0.2573953410
In [32]:
(long_corrs <- pooled_df_long %>%
group_by(gene) %>%
summarise(long_cor = cor(order, expression, method = "spearman")))
A tibble: 17513 × 2
genelong_cor
<chr><dbl>
AT1G01010 0.63636364
AT1G01020-0.40606061
AT1G01030-0.44242424
AT1G01040 0.68484848
AT1G01050-0.91515152
AT1G01070 0.17575758
AT1G01080 0.28484848
AT1G01090-0.89090909
AT1G01100-0.91515152
AT1G01110-0.70909091
AT1G01120 0.87878788
AT1G01130 0.20000000
AT1G01160-0.44242424
AT1G01170 0.18787879
AT1G01180 0.91515152
AT1G01200 0.55151515
AT1G01210-0.15151515
AT1G01220-0.87878788
AT1G01225-0.57575758
AT1G01230 0.05454545
AT1G01240 0.63636364
AT1G01260-0.98787879
AT1G01290-0.60000000
AT1G01300-0.93939394
AT1G01310 0.84242424
AT1G01320 0.10303030
AT1G01340 0.96363636
AT1G01350 0.57575758
AT1G01360-0.61212121
AT1G01370-0.58787879
⋮⋮
AT5G67320 0.17575758
AT5G67330 0.92727273
AT5G67340 0.92727273
AT5G67360-0.52727273
AT5G67370 0.89090909
AT5G67380 0.56363636
AT5G67385-0.23636364
AT5G67390-0.44242424
AT5G67400 0.80606061
AT5G67410-0.75757576
AT5G67420-0.18787879
AT5G67440 0.11515152
AT5G67450 0.18787879
AT5G67460-0.13939394
AT5G67470 0.01818182
AT5G67488 0.04242424
AT5G67500 0.89090909
AT5G67510-0.13939394
AT5G67520 0.84242424
AT5G67530-0.87878788
AT5G67540-0.63636364
AT5G67560 0.93939394
AT5G67570-0.95151515
AT5G67580 0.57575758
AT5G67590 1.00000000
AT5G67600 0.52727273
AT5G67610-0.07878788
AT5G67620 0.57575758
AT5G67630-0.12727273
AT5G67640-0.07878788
In [33]:
Clust_Markers <- left_join(Clust_Markers, long_corrs) %>%
mutate(abs_long_cor=abs(long_cor)) %>%
arrange(-abs_long_cor)
Clust_Markers
Joining, by = "gene"

A grouped_df: 22271 × 17
myAUCavg_diffpowerpct.1pct.2clustercelltypestagegeneNamepct.diffpct.diff_rankavg_diff_rankmyAUC_rankcombined_ranklong_corabs_long_cor
<dbl><dbl><dbl><dbl><dbl><fct><chr><fct><chr><chr><dbl><int><int><int><int><dbl><dbl>
0.8791.39300700.7580.9950.470Endodermis_T6 Endodermis T6AT1G02900RALF1 0.525 19 65 1 9 11
0.8401.41899370.6800.9560.500Endodermis_T7 Endodermis T7AT5G58375AT5G583750.456 41101 520 11
0.8281.12501080.6560.9910.469Endodermis_T7 Endodermis T7AT1G02900RALF1 0.522 15157 728 11
0.8773.08794770.7540.9240.398Cortex_T9 Cortex T9AT5G60360AALP 0.526100 13 4029 11
0.8331.15649660.6660.9880.465Endodermis_T5 Endodermis T5AT1G02900RALF1 0.523 37110 1631 11
0.8031.08833000.6060.8170.317Endodermis_T7 Endodermis T7AT5G63905AT5G639050.500 22166 1638 11
0.7951.99642750.5900.8010.286Cortex_T8 Cortex T8AT2G15370FUT5 0.515 60 72 8141 11
0.9113.36345130.8220.9170.314Endodermis_T9 Endodermis T9AT3G20510FAX6 0.603113 62 5342 11
0.8041.79671790.6080.8270.314Endodermis_T8 Endodermis T8AT5G63905AT5G639050.513 58123 8442 11
0.9434.00046410.8860.9570.216Stem Cell Niche_T1Stem Cell NicheT1AT2G31610RPS3A 0.741191 10 7043-11
0.8581.77017280.7160.9490.433Cortex_T8 Cortex T8AT3G26520TIP1-2 0.516 59147 2145 11
0.8532.56055630.7060.8840.306Cortex_T9 Cortex T9AT1G11310MLO2 0.578 65 86 6349 11
0.9312.38875770.8620.9870.437Cortex_T9 Cortex T9AT3G26520TIP1-2 0.550 80126 950 11
0.9431.81660620.8861.0000.219Cortex_T0 Cortex T0AT1G54000GLL22 0.781 31265 4550-11
0.9394.05437010.8780.9760.483Endodermis_T9 Endodermis T9AT5G55850NOI 0.493249 8 2854 11
0.8711.52866240.7420.9630.497Endodermis_T8 Endodermis T8AT5G58375AT5G583750.466124171 954 11
0.8463.09233240.6920.9300.454Cortex_T9 Cortex T9AT3G30390AVT6A 0.476148 12 7156 11
0.8643.31601460.7280.8950.327Endodermis_T9 Endodermis T9AT2G24940MP3 0.568145 6611460 11
0.8592.39389250.7180.8790.288Cortex_T9 Cortex T9AT2G15370FUT5 0.591 56124 5661 11
0.7952.09605100.5900.6890.262Cortex_T8 Cortex T8AT2G40110AT2G401100.427133 49 8061 11
0.8493.95077650.6980.8480.315Endodermis_T9 Endodermis T9AT3G46000ADF2 0.533193 1613762 11
0.8130.60421550.6260.8710.349Endodermis_T7 Endodermis T7AT2G24940MP3 0.522 16264 1264 11
0.8993.72283080.7980.9370.447Endodermis_T9 Endodermis T9AT3G61260AT3G612600.490253 34 6465 11
0.7501.66499550.5000.8370.499Cortex_T7 Cortex T7AT1G05850CTL1 0.338136 23 8271 11
0.9612.74510140.9220.9900.130Stem Cell Niche_T0Stem Cell NicheT0AT2G34480AT2G344800.860100229 8371-11
0.8532.64668080.7060.9370.456Cortex_T9 Cortex T9AT4G39080VHA-A3 0.481139 68 6272 11
0.7892.04881520.5780.8820.464Cortex_T8 Cortex T8AT5G34850PAP26 0.418148 56 8975 11
0.9453.11806940.8900.9730.177Stem Cell Niche_T1Stem Cell NicheT1AT2G34480AT2G344800.796 69253 5875-11
0.8642.51248160.7280.9630.482Cortex_T9 Cortex T9AT5G43600UAH 0.481140 95 4877 11
0.7921.67489990.5840.7930.339Endodermis_T8 Endodermis T8AT3G20510FAX6 0.45414114210981 11
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
0.7101.64757510.4200.6250.170Stem Cell Niche_T0 Stem Cell Niche T0AT3G08000AT3G08000 0.4551753141521501924-0.0060606060.006060606
0.7121.07720930.4240.5370.078Stem Cell Niche_T1 Stem Cell Niche T1AT5G48100TT10 0.4591566171621181947 0.0060606060.006060606
0.7660.89092120.5320.5370.178Stem Cell Niche_T1 Stem Cell Niche T1AT5G14960E2FD 0.3592065186115271962-0.0060606060.006060606
0.7142.38769530.4280.5410.206Quiescent Center_T1Quiescent CenterT1AT5G02710AT5G02710 0.3352340 86422741996-0.0060606060.006060606
0.7791.02604620.5580.7510.202Quiescent Center_T0Quiescent CenterT0AT3G50190AT3G50190 0.5491575248216632012 0.0060606060.006060606
0.7420.92161260.4840.6330.156Quiescent Center_T1Quiescent CenterT1AT1G71420PCMP-H70 0.4771559205719542039-0.0060606060.006060606
0.7490.73867910.4980.6900.303Stem Cell Niche_T1 Stem Cell Niche T1AT3G49680BCAT3 0.3871953197517022049-0.0060606060.006060606
0.7351.76602910.4700.5780.205Quiescent Center_T1Quiescent CenterT1AT3G45050AT3G45050 0.3732217145620432085 0.0060606060.006060606
0.7061.60261200.4120.6700.282Stem Cell Niche_T0 Stem Cell Niche T0AT3G49680BCAT3 0.3882113146122252085-0.0060606060.006060606
0.7340.57670490.4680.6420.180Quiescent Center_T1Quiescent CenterT1AT3G03950ECT1 0.4621662227220602179 0.0060606060.006060606
0.7540.38596440.5080.2670.015Stem Cell Niche_T1 Stem Cell Niche T1AT5G44580AT5G44580 0.2522238222516562194-0.0060606060.006060606
0.7061.07565430.4120.5000.088Stem Cell Niche_T0 Stem Cell Niche T0AT3G44290NAC60 0.4122001195822322215-0.0060606060.006060606
0.7330.42125280.4660.4040.066Stem Cell Niche_T1 Stem Cell Niche T1AT5G62710AT5G62710 0.3382131219918762217-0.0060606060.006060606
0.7411.48266010.4820.6390.142Quiescent Center_T0Quiescent CenterT0AT4G21820AT4G21820 0.4971991201822482233-0.0060606060.006060606
0.8050.41909040.6100.7070.216Quiescent Center_T0Quiescent CenterT0AT5G11650AT5G11650 0.4912049289913222236-0.0060606060.006060606
0.7141.14193590.4280.5090.220Stem Cell Niche_T0 Stem Cell Niche T0AT5G11650AT5G11650 0.2892303190320952248-0.0060606060.006060606
0.2290.91177470.5420.1020.491Stem Cell Niche_T1 Stem Cell Niche T1AT1G23380KNAT6 -0.3892302184622992263 0.0060606060.006060606
0.7650.59646990.5300.4400.104Quiescent Center_T1Quiescent CenterT1AT5G25170AT5G25170 0.3362337225816832272-0.0060606060.006060606
0.2440.58184560.5120.0900.470Stem Cell Niche_T1 Stem Cell Niche T1AT4G29810ATMKK2 -0.3802300209422952298 0.0060606060.006060606
0.2780.49575630.4440.1530.373Stem Cell Niche_T1 Stem Cell Niche T1AT5G35525PCR3 -0.2202266215222772299-0.0060606060.006060606
0.7121.27176910.4240.4590.122Quiescent Center_T1Quiescent CenterT1AT4G37380ELI1 0.3372335184023062328 0.0060606060.006060606
0.2931.28120980.4140.1650.420Quiescent Center_T1Quiescent CenterT1AT2G27830AT2G27830-0.2552461182424452392-0.0060606060.006060606
0.2420.34763670.5160.0920.365Quiescent Center_T1Quiescent CenterT1AT4G10140AT4G10140-0.2732466243124832490 0.0060606060.006060606
0.2480.27327630.5040.1380.489Quiescent Center_T1Quiescent CenterT1AT1G23380KNAT6 -0.3512485247724802494 0.0060606060.006060606
0.7460.44523420.4920.6930.177Quiescent Center_T0Quiescent CenterT0AT1G30520AAE14 0.5161850288621812510 0.0060606060.006060606
0.7420.93930470.4840.6660.185Quiescent Center_T0Quiescent CenterT0AT3G45050AT3G45050 0.4812124256622412519 0.0060606060.006060606
0.7071.48655090.4140.6360.166Quiescent Center_T0Quiescent CenterT0AT3G15420AT3G15420 0.4702216201328382576 0.0060606060.006060606
0.7271.19022690.4540.5150.109Quiescent Center_T0Quiescent CenterT0AT3G09910RABC2B 0.4062631234224842692 0.0060606060.006060606
0.7330.85779730.4660.7070.271Quiescent Center_T0Quiescent CenterT0AT2G07776AT2G07776 0.4362468262923782698 0.0060606060.006060606
0.7131.03769570.4260.6450.232Quiescent Center_T0Quiescent CenterT0AT2G16880AT2G16880 0.4132595246927342794 0.0060606060.006060606
In [34]:
genes_to_plt_df <- filter(Clust_Markers, celltype %in% c("Endodermis")) %>%
group_by(stage) %>%
top_n(20, -combined_rank) %>%
top_n(10, abs_long_cor) %>%
ungroup() %>%
arrange(stage)
# genes manually added to plotting list - these are known markers we want to make sure are there
to_add <- filter(Clust_Markers, celltype %in% c("Endodermis")) %>% filter(Name=="SCR" | Name=="MYB36" | Name=="CASP4")

(genes_to_plt_df <- bind_rows(genes_to_plt_df, to_add) %>% 
 ungroup() %>% 
 group_by(gene) %>%
 top_n(1, -combined_rank) %>% # order genes by stage of highest rank
 ungroup() %>% arrange(stage))

genes_to_plt <- unique(genes_to_plt_df$gene)

genes_to_plt_endo <- rev(genes_to_plt) # order to pointing upwards
A tibble: 91 × 17
myAUCavg_diffpowerpct.1pct.2clustercelltypestagegeneNamepct.diffpct.diff_rankavg_diff_rankmyAUC_rankcombined_ranklong_corabs_long_cor
<dbl><dbl><dbl><dbl><dbl><fct><chr><fct><chr><chr><dbl><int><int><int><int><dbl><dbl>
0.9793.5409770.9581.0000.251Endodermis_T0EndodermisT0AT3G56220AT3G562200.749 6637 713-0.91515150.9151515
0.9875.2821130.9741.0000.333Endodermis_T0EndodermisT0AT3G52960PRXIIE 0.667162 2 220-0.90303030.9030303
0.9694.5821150.9381.0000.245Endodermis_T0EndodermisT0AT5G48660AT5G486600.755 61 716 9-0.89090910.8909091
0.9763.6588230.9521.0000.217Endodermis_T0EndodermisT0AT2G20515AT2G205150.783 4729 8 8-0.87878790.8787879
0.9672.8541380.9341.0000.219Endodermis_T0EndodermisT0AT2G45050GATA2 0.781 49652416-0.87878790.8787879
0.9543.3305300.9081.0000.248Endodermis_T0EndodermisT0AT3G60530GATA4 0.752 64434517-0.85454550.8545455
0.9432.4019870.8861.0000.128Endodermis_T0EndodermisT0AT4G21960PER42 0.872 2887419-0.84242420.8424242
0.9893.8438610.9781.0000.191Endodermis_T0EndodermisT0AT1G46264HSFB4 0.809 3025 1 3-0.79393940.7939394
0.9693.6482400.9381.0000.210Endodermis_T0EndodermisT0AT3G05190AT3G051900.790 42301712-0.79393940.7939394
0.8802.8909930.7600.7860.178Endodermis_T1EndodermisT1AT5G27670HTA7 0.608 49233217-0.95151520.9515152
0.9142.8895640.8280.9020.263Endodermis_T1EndodermisT1AT1G14900HMGA 0.639 3424 8 6-0.93939390.9393939
0.9182.7419480.8360.9190.258Endodermis_T1EndodermisT1AT5G59910HTB4 0.661 2243 6 8-0.92727270.9272727
0.8883.3042990.7760.9020.297Endodermis_T1EndodermisT1AT2G22230AT2G222300.605 54 323 9-0.91515150.9151515
0.8832.8008170.7660.9360.323Endodermis_T1EndodermisT1AT2G43360BIO2 0.613 46352818-0.89090910.8909091
0.9323.0493820.8640.9250.157Endodermis_T1EndodermisT1AT5G07030AT5G070300.768 210 1 1-0.85454550.8545455
0.9023.0552660.8040.9190.272Endodermis_T1EndodermisT1AT5G28640GIF1 0.647 28 915 2-0.85454550.8545455
0.9122.8476390.8240.9360.287Endodermis_T1EndodermisT1AT5G23860TUBB8 0.649 272910 7-0.85454550.8545455
0.9132.6249920.8260.9130.276Endodermis_T1EndodermisT1AT3G45980H2B 0.637 3558 916-0.81818180.8181818
0.9292.6043590.8580.9310.161Endodermis_T1EndodermisT1AT3G54560H2AV 0.770 162 2 5-0.80606060.8060606
0.8641.8588600.7280.9520.366Endodermis_T2EndodermisT2AT4G16265NRPB9B 0.586 34801614-0.91515150.9151515
0.8681.9219040.7360.8900.282Endodermis_T2EndodermisT2AT5G55730FLA1 0.608 25731211-0.90303030.9030303
0.8732.6391950.7460.9430.458Endodermis_T2EndodermisT2AT1G54580ACP2 0.485117 8 917-0.90303030.9030303
0.8282.4094040.6560.8750.346Endodermis_T2EndodermisT2AT4G39900AT4G399000.529 68165819-0.86666670.8666667
0.8222.8420890.6440.8090.196Endodermis_T2EndodermisT2AT4G17970ALMT12 0.613 23 47010-0.79393940.7939394
0.8262.7820400.6520.7970.134Endodermis_T2EndodermisT2AT1G65900AT1G659000.663 6 560 5-0.75757580.7575758
0.8882.4255910.7760.8870.164Endodermis_T2EndodermisT2AT3G23730XTH16 0.723 115 4 1-0.74545450.7454545
0.9092.1926740.8180.9500.255Endodermis_T2EndodermisT2AT5G63660PDF2.5 0.695 241 2 4-0.73333330.7333333
0.8412.3098410.6820.9320.413Endodermis_T2EndodermisT2AT1G13280AOC4 0.519 72263618-0.73333330.7333333
0.8302.3566820.6600.8840.388Endodermis_T2EndodermisT2AT3G54220SCR 0.496104205127-0.51515150.5151515
0.8301.9453940.6600.8480.206Endodermis_T3EndodermisT3AT5G45200AT5G452000.642 12305216-0.69696970.6969697
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
0.8171.6146350.6340.9170.467Endodermis_T6EndodermisT6AT5G25770AT5G257700.45047 3713150.70909090.7090909
0.8401.4189940.6800.9560.500Endodermis_T7EndodermisT7AT5G58375AT5G583750.45641101 5201.00000001.0000000
0.8631.7284070.7260.9700.498Endodermis_T7EndodermisT7AT3G06125AT3G061250.47232 52 4 90.98787880.9878788
0.7832.0314730.5660.8540.394Endodermis_T7EndodermisT7AT5G21090LRR1 0.46039 2528110.98787880.9878788
0.7711.8340360.5420.8430.379Endodermis_T7EndodermisT7AT5G42030ABIL4 0.46438 4442160.98787880.9878788
0.8771.7142000.7540.9390.222Endodermis_T7EndodermisT7AT5G66390PER72 0.717 1 55 1 20.97575760.9757576
0.8031.6911730.6060.9020.446Endodermis_T7EndodermisT7AT3G09270GSTU8 0.45640 5915140.95151520.9515152
0.8161.7262620.6320.8520.296Endodermis_T7EndodermisT7AT4G23493AT4G234930.556 9 5310 60.93939390.9393939
0.7901.8530270.5800.6660.234Endodermis_T7EndodermisT7AT5G08240AT5G082400.43251 4122150.87878790.8787879
0.8371.7559290.6740.6990.131Endodermis_T7EndodermisT7AT4G21620AT4G216200.568 7 49 6 30.86666670.8666667
0.7961.8947450.5920.7990.318Endodermis_T7EndodermisT7AT2G15340AT2G153400.48128 3519 70.86666670.8666667
0.8191.7151910.6380.8000.310Endodermis_T7EndodermisT7AT4G34230CAD5 0.49024 54 8 80.86666670.8666667
0.8472.1807720.6940.8420.189Endodermis_T8EndodermisT8AT3G03520NPC3 0.65315 5614 40.97575760.9757576
0.8212.5212370.6420.7090.163Endodermis_T8EndodermisT8AT3G14280AT3G142800.54634 1950 90.95151520.9515152
0.8412.0476160.6820.8600.183Endodermis_T8EndodermisT8AT4G13580DIR18 0.677 9 7821100.90303030.9030303
0.8422.5773150.6840.6820.140Endodermis_T8EndodermisT8AT1G03850AT1G038500.54235 1620 10.89090910.8909091
0.8212.2663730.6420.7280.206Endodermis_T8EndodermisT8AT4G37790HAT22 0.52253 4151160.85454550.8545455
0.9231.9703030.8460.9900.220Endodermis_T8EndodermisT8AT2G36100CASP1 0.770 2 90 1 70.84242420.8424242
0.8291.9981270.6580.8690.146Endodermis_T8EndodermisT8AT3G24020DIR16 0.723 6 8334120.84242420.8424242
0.9623.3730940.9240.9770.282Endodermis_T9EndodermisT9AT4G34050CCoAOMT1 0.69552 61 4 90.98787880.9878788
0.9134.0303380.8260.9160.262Endodermis_T9EndodermisT9AT5G44790RAN1 0.65473 1149140.98787880.9878788
0.9163.6060870.8320.9490.266Endodermis_T9EndodermisT9AT1G80640AT1G806400.68359 4346200.98787880.9878788
0.9643.2925320.9280.9780.192Endodermis_T9EndodermisT9AT2G27370CASP3 0.78620 68 3 70.97575760.9757576
0.9462.9517740.8920.9630.134Endodermis_T9EndodermisT9AT2G28671AT2G286710.829 9 9822120.96363640.9636364
0.9553.3963810.9100.9620.130Endodermis_T9EndodermisT9AT1G44970PER9 0.832 7 60 9 40.95151520.9515152
0.9443.4096770.8880.9390.204Endodermis_T9EndodermisT9AT5G65020ANN2 0.73534 5824 80.95151520.9515152
0.9703.2644610.9400.9830.124Endodermis_T9EndodermisT9AT2G39430DIR9 0.859 1 70 1 30.79393940.7939394
0.9482.9459620.8960.9650.115Endodermis_T9EndodermisT9AT3G11550CASP2 0.850 510019100.79393940.7939394
0.8953.4275540.7900.8950.108Endodermis_T9EndodermisT9AT4G02090AT4G020900.78719 5770170.79393940.7939394
0.9523.2417740.9040.9640.106Endodermis_T9EndodermisT9AT5G06200CASP4 0.858 2 7315 60.76969700.7696970
In [35]:
genes_to_plt_df <- filter(Clust_Markers, celltype %in% c("Cortex")) %>%
group_by(stage) %>%
top_n(20, -combined_rank) %>%
top_n(10, abs_long_cor) %>%
ungroup() %>%
arrange(stage)

# to add AT4G09760 AT5G02000

to_add <- filter(Clust_Markers, celltype %in% c("Cortex")) %>% filter(gene %in% c("AT4G09760", "AT5G02000", "AT5G64620"))

(genes_to_plt_df <- bind_rows(genes_to_plt_df, to_add) %>% 
 ungroup() %>% 
 group_by(gene) %>%
 top_n(1, -combined_rank) %>%
 ungroup() %>% arrange(stage))



(genes_to_plt_df <- genes_to_plt_df %>% 
 ungroup() %>% 
 group_by(gene) %>%
 top_n(1, -combined_rank) %>%
 ungroup() %>% arrange(stage))

genes_to_plt <- unique(genes_to_plt_df$gene)

genes_to_plt_cortex <- genes_to_plt
A tibble: 92 × 17
myAUCavg_diffpowerpct.1pct.2clustercelltypestagegeneNamepct.diffpct.diff_rankavg_diff_rankmyAUC_rankcombined_ranklong_corabs_long_cor
<dbl><dbl><dbl><dbl><dbl><fct><chr><fct><chr><chr><dbl><int><int><int><int><dbl><dbl>
0.9753.9866480.9501.0000.268Cortex_T0CortexT0AT3G18000NMT1 0.732 55 36 5 7-0.97575760.9757576
0.9432.7802270.8861.0000.237Cortex_T0CortexT0AT1G68560XYL1 0.763 37132 4320-0.97575760.9757576
0.9744.5380780.9481.0000.265Cortex_T0CortexT0AT2G24280AT2G242800.735 52 7 7 3-0.92727270.9272727
0.9533.2191540.9061.0000.248Cortex_T0CortexT0AT3G09455OST4C 0.752 43 95 2612-0.91515150.9151515
0.9484.5378720.8961.0000.333Cortex_T0CortexT0AT3G52960PRXIIE 0.667125 8 3011-0.90303030.9030303
0.9194.3234960.8381.0000.304Cortex_T0CortexT0AT3G54960PDIL1-3 0.696 87 1610219-0.90303030.9030303
0.9314.1301250.8620.9090.215Cortex_T0CortexT0AT2G34020AT2G340200.694 88 28 6717-0.89090910.8909091
0.9803.9391010.9601.0000.217Cortex_T0CortexT0AT2G20515AT2G205150.783 27 38 2 5-0.87878790.8787879
0.9793.6179220.9581.0000.219Cortex_T0CortexT0AT2G45050GATA2 0.781 30 61 3 6-0.87878790.8787879
0.9333.7594400.8661.0000.283Cortex_T0CortexT0AT5G05890UGT76C5 0.717 63 50 6015-0.87878790.8787879
0.9233.0227780.8460.9550.306Cortex_T1CortexT1AT4G34200PGDH1 0.649 44 33 1614-0.97575760.9757576
0.8933.3997730.7860.9610.315Cortex_T1CortexT1AT2G21250AT2G212500.646 46 6 5916-0.97575760.9757576
0.9053.3493060.8100.9550.252Cortex_T1CortexT1AT1G09580AT1G095800.703 17 7 33 7-0.95151520.9515152
0.8793.1668580.7580.8830.235Cortex_T1CortexT1AT5G22580AT5G225800.648 45 20 8218-0.95151520.9515152
0.9243.1158270.8480.9610.319Cortex_T1CortexT1AT5G50375CPI1 0.642 50 24 1511-0.92727270.9272727
0.9012.4535290.8020.9090.246Cortex_T1CortexT1AT3G56220AT3G562200.663 30 82 3919-0.91515150.9151515
0.9293.0225980.8580.9870.387Cortex_T1CortexT1AT5G48580FKBP15-2 0.600108 34 1220-0.91515150.9151515
0.8332.1750010.6660.7970.282Cortex_T2CortexT2AT1G17285AT1G172850.515 31 48 23 7-0.98787880.9878788
0.8662.4431800.7320.8480.254Cortex_T2CortexT2AT5G14020AT5G140200.594 7 28 3 1-0.97575760.9757576
0.8422.0960640.6840.8540.315Cortex_T2CortexT2AT5G67070RALFL34 0.539 20 59 14 6-0.95151520.9515152
0.8342.2522010.6680.8630.377Cortex_T2CortexT2AT1G64900CYP89A2 0.486 54 41 21 8-0.92727270.9272727
0.8402.7741220.6800.8870.433Cortex_T2CortexT2AT3G19820DIM 0.454102 8 1512-0.92727270.9272727
0.8302.4604560.6600.7700.233Cortex_T2CortexT2AT3G60530GATA4 0.537 21 25 26 4-0.85454550.8545455
0.8372.2686210.6740.8270.279Cortex_T2CortexT2AT5G35740AT5G357400.548 18 40 19 5-0.84242420.8424242
0.8082.5697620.6160.8250.368Cortex_T2CortexT2AT1G21750PDIL1-1 0.457 98 15 5220-0.83030300.8303030
0.8502.4569990.7000.8780.339Cortex_T2CortexT2AT5G66590AT5G665900.539 19 26 7 2-0.80606060.8060606
0.8381.8031680.6760.8950.332Cortex_T2CortexT2AT5G02000AT5G020000.563 10108 1714-0.40606060.4060606
0.8772.0521810.7540.9310.286Cortex_T3CortexT3AT5G12940AT5G129400.645 6 23 4 2-0.78181820.7818182
0.8402.0548010.6800.8910.318Cortex_T3CortexT3AT1G70280AT1G702800.573 24 22 31 8-0.76969700.7696970
0.8342.2458020.6680.9070.406Cortex_T3CortexT3AT4G03190GRH1 0.501 74 6 4313-0.73333330.7333333
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
0.8261.3004250.6520.8880.352Cortex_T7CortexT7AT5G60660PIP2-4 0.53615 68 11130.96363640.9636364
0.8531.5952890.7060.8040.245Cortex_T7CortexT7AT3G01190PER27 0.559 8 29 2 20.95151520.9515152
0.7841.9178200.5680.6090.192Cortex_T7CortexT7AT1G66725MIR163 0.41766 7 39170.95151520.9515152
0.8221.1425790.6440.9030.352Cortex_T7CortexT7AT3G14690CYP72A15 0.55110 99 14200.95151520.9515152
0.7791.6199070.5580.6670.193Cortex_T7CortexT7AT4G00330CRCK2 0.47431 26 44150.92727270.9272727
0.8541.4687300.7080.9440.335Cortex_T7CortexT7AT1G62510AT1G625100.609 3 45 1 40.91515150.9151515
0.8092.0416620.6180.6980.223Cortex_T7CortexT7AT2G39110AT2G391100.47530 2 21 50.91515150.9151515
0.8221.4313370.6440.8200.318Cortex_T7CortexT7AT2G34500CYP710A1 0.50225 51 13110.91515150.9151515
0.8552.2418900.7100.8640.327Cortex_T8CortexT8AT4G37010CEN2 0.53743 19 22 70.98787880.9878788
0.8721.9760960.7440.7790.176Cortex_T8CortexT8AT5G63600FLS5 0.60319 76 13110.98787880.9878788
0.8971.8730640.7940.9940.348Cortex_T8CortexT8AT3G57020SSL9 0.646 9114 5150.98787880.9878788
0.8681.9682750.7360.9140.363Cortex_T8CortexT8AT4G23400PIP1-5 0.55135 79 14160.98787880.9878788
0.9242.0575100.8480.9550.173Cortex_T8CortexT8AT5G15180PER56 0.782 1 55 1 30.97575760.9757576
0.9042.0911830.8080.7900.106Cortex_T8CortexT8AT5G64100PER69 0.684 3 52 2 40.97575760.9757576
0.8512.3624290.7020.7540.189Cortex_T8CortexT8AT2G31570GPX2 0.56532 12 24 50.97575760.9757576
0.8412.0951640.6820.7810.210Cortex_T8CortexT8AT1G47480CXE2 0.57129 50 35120.97575760.9757576
0.8611.9379810.7220.8770.246Cortex_T8CortexT8AT4G02700SULTR3;2 0.63114 91 19140.97575760.9757576
0.8781.8792110.7560.9150.270Cortex_T8CortexT8AT5G19240AT5G192400.64510112 10190.97575760.9757576
0.7752.1120770.5500.6780.197Cortex_T8CortexT8AT4G09760AT4G097600.48183 44120560.73333330.7333333
0.9313.0832620.8620.9350.172Cortex_T9CortexT9AT5G44480DUR 0.763 4 15 6 10.98787880.9878788
0.9312.6396330.8620.9590.183Cortex_T9CortexT9AT5G44380AT5G443800.776 3 69 7 70.98787880.9878788
0.9372.6144550.8740.9580.196Cortex_T9CortexT9AT4G17340TIP2-2 0.762 5 75 3 80.98787880.9878788
0.8852.7608090.7700.8020.094Cortex_T9CortexT9AT5G49760AT5G497600.708 8 51 25 90.98787880.9878788
0.8603.1531480.7200.7880.140Cortex_T9CortexT9AT2G43050PME16 0.64826 5 54100.98787880.9878788
0.8892.8225210.7780.8690.238Cortex_T9CortexT9AT3G51730AT3G517300.63135 37 23120.98787880.9878788
0.8773.5501760.7540.9090.321Cortex_T9CortexT9AT3G48890MSBP2 0.58857 1 39130.98787880.9878788
0.8723.0860080.7440.8350.219Cortex_T9CortexT9AT4G15610AT4G156100.61641 14 43140.98787880.9878788
0.8542.8574610.7080.8390.131Cortex_T9CortexT9AT2G27920SCPL51 0.708 9 31 60150.98787880.9878788
0.8662.8490580.7320.8480.183Cortex_T9CortexT9AT3G18170AT3G181700.66521 34 46170.98787880.9878788
0.9312.5667510.8620.9820.304Cortex_T9CortexT9AT5G53370ATPMEPCRF0.67818 84 8180.98787880.9878788
A tibble: 92 × 17
myAUCavg_diffpowerpct.1pct.2clustercelltypestagegeneNamepct.diffpct.diff_rankavg_diff_rankmyAUC_rankcombined_ranklong_corabs_long_cor
<dbl><dbl><dbl><dbl><dbl><fct><chr><fct><chr><chr><dbl><int><int><int><int><dbl><dbl>
0.9753.9866480.9501.0000.268Cortex_T0CortexT0AT3G18000NMT1 0.732 55 36 5 7-0.97575760.9757576
0.9432.7802270.8861.0000.237Cortex_T0CortexT0AT1G68560XYL1 0.763 37132 4320-0.97575760.9757576
0.9744.5380780.9481.0000.265Cortex_T0CortexT0AT2G24280AT2G242800.735 52 7 7 3-0.92727270.9272727
0.9533.2191540.9061.0000.248Cortex_T0CortexT0AT3G09455OST4C 0.752 43 95 2612-0.91515150.9151515
0.9484.5378720.8961.0000.333Cortex_T0CortexT0AT3G52960PRXIIE 0.667125 8 3011-0.90303030.9030303
0.9194.3234960.8381.0000.304Cortex_T0CortexT0AT3G54960PDIL1-3 0.696 87 1610219-0.90303030.9030303
0.9314.1301250.8620.9090.215Cortex_T0CortexT0AT2G34020AT2G340200.694 88 28 6717-0.89090910.8909091
0.9803.9391010.9601.0000.217Cortex_T0CortexT0AT2G20515AT2G205150.783 27 38 2 5-0.87878790.8787879
0.9793.6179220.9581.0000.219Cortex_T0CortexT0AT2G45050GATA2 0.781 30 61 3 6-0.87878790.8787879
0.9333.7594400.8661.0000.283Cortex_T0CortexT0AT5G05890UGT76C5 0.717 63 50 6015-0.87878790.8787879
0.9233.0227780.8460.9550.306Cortex_T1CortexT1AT4G34200PGDH1 0.649 44 33 1614-0.97575760.9757576
0.8933.3997730.7860.9610.315Cortex_T1CortexT1AT2G21250AT2G212500.646 46 6 5916-0.97575760.9757576
0.9053.3493060.8100.9550.252Cortex_T1CortexT1AT1G09580AT1G095800.703 17 7 33 7-0.95151520.9515152
0.8793.1668580.7580.8830.235Cortex_T1CortexT1AT5G22580AT5G225800.648 45 20 8218-0.95151520.9515152
0.9243.1158270.8480.9610.319Cortex_T1CortexT1AT5G50375CPI1 0.642 50 24 1511-0.92727270.9272727
0.9012.4535290.8020.9090.246Cortex_T1CortexT1AT3G56220AT3G562200.663 30 82 3919-0.91515150.9151515
0.9293.0225980.8580.9870.387Cortex_T1CortexT1AT5G48580FKBP15-2 0.600108 34 1220-0.91515150.9151515
0.8332.1750010.6660.7970.282Cortex_T2CortexT2AT1G17285AT1G172850.515 31 48 23 7-0.98787880.9878788
0.8662.4431800.7320.8480.254Cortex_T2CortexT2AT5G14020AT5G140200.594 7 28 3 1-0.97575760.9757576
0.8422.0960640.6840.8540.315Cortex_T2CortexT2AT5G67070RALFL34 0.539 20 59 14 6-0.95151520.9515152
0.8342.2522010.6680.8630.377Cortex_T2CortexT2AT1G64900CYP89A2 0.486 54 41 21 8-0.92727270.9272727
0.8402.7741220.6800.8870.433Cortex_T2CortexT2AT3G19820DIM 0.454102 8 1512-0.92727270.9272727
0.8302.4604560.6600.7700.233Cortex_T2CortexT2AT3G60530GATA4 0.537 21 25 26 4-0.85454550.8545455
0.8372.2686210.6740.8270.279Cortex_T2CortexT2AT5G35740AT5G357400.548 18 40 19 5-0.84242420.8424242
0.8082.5697620.6160.8250.368Cortex_T2CortexT2AT1G21750PDIL1-1 0.457 98 15 5220-0.83030300.8303030
0.8502.4569990.7000.8780.339Cortex_T2CortexT2AT5G66590AT5G665900.539 19 26 7 2-0.80606060.8060606
0.8381.8031680.6760.8950.332Cortex_T2CortexT2AT5G02000AT5G020000.563 10108 1714-0.40606060.4060606
0.8772.0521810.7540.9310.286Cortex_T3CortexT3AT5G12940AT5G129400.645 6 23 4 2-0.78181820.7818182
0.8402.0548010.6800.8910.318Cortex_T3CortexT3AT1G70280AT1G702800.573 24 22 31 8-0.76969700.7696970
0.8342.2458020.6680.9070.406Cortex_T3CortexT3AT4G03190GRH1 0.501 74 6 4313-0.73333330.7333333
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
0.8261.3004250.6520.8880.352Cortex_T7CortexT7AT5G60660PIP2-4 0.53615 68 11130.96363640.9636364
0.8531.5952890.7060.8040.245Cortex_T7CortexT7AT3G01190PER27 0.559 8 29 2 20.95151520.9515152
0.7841.9178200.5680.6090.192Cortex_T7CortexT7AT1G66725MIR163 0.41766 7 39170.95151520.9515152
0.8221.1425790.6440.9030.352Cortex_T7CortexT7AT3G14690CYP72A15 0.55110 99 14200.95151520.9515152
0.7791.6199070.5580.6670.193Cortex_T7CortexT7AT4G00330CRCK2 0.47431 26 44150.92727270.9272727
0.8541.4687300.7080.9440.335Cortex_T7CortexT7AT1G62510AT1G625100.609 3 45 1 40.91515150.9151515
0.8092.0416620.6180.6980.223Cortex_T7CortexT7AT2G39110AT2G391100.47530 2 21 50.91515150.9151515
0.8221.4313370.6440.8200.318Cortex_T7CortexT7AT2G34500CYP710A1 0.50225 51 13110.91515150.9151515
0.8552.2418900.7100.8640.327Cortex_T8CortexT8AT4G37010CEN2 0.53743 19 22 70.98787880.9878788
0.8721.9760960.7440.7790.176Cortex_T8CortexT8AT5G63600FLS5 0.60319 76 13110.98787880.9878788
0.8971.8730640.7940.9940.348Cortex_T8CortexT8AT3G57020SSL9 0.646 9114 5150.98787880.9878788
0.8681.9682750.7360.9140.363Cortex_T8CortexT8AT4G23400PIP1-5 0.55135 79 14160.98787880.9878788
0.9242.0575100.8480.9550.173Cortex_T8CortexT8AT5G15180PER56 0.782 1 55 1 30.97575760.9757576
0.9042.0911830.8080.7900.106Cortex_T8CortexT8AT5G64100PER69 0.684 3 52 2 40.97575760.9757576
0.8512.3624290.7020.7540.189Cortex_T8CortexT8AT2G31570GPX2 0.56532 12 24 50.97575760.9757576
0.8412.0951640.6820.7810.210Cortex_T8CortexT8AT1G47480CXE2 0.57129 50 35120.97575760.9757576
0.8611.9379810.7220.8770.246Cortex_T8CortexT8AT4G02700SULTR3;2 0.63114 91 19140.97575760.9757576
0.8781.8792110.7560.9150.270Cortex_T8CortexT8AT5G19240AT5G192400.64510112 10190.97575760.9757576
0.7752.1120770.5500.6780.197Cortex_T8CortexT8AT4G09760AT4G097600.48183 44120560.73333330.7333333
0.9313.0832620.8620.9350.172Cortex_T9CortexT9AT5G44480DUR 0.763 4 15 6 10.98787880.9878788
0.9312.6396330.8620.9590.183Cortex_T9CortexT9AT5G44380AT5G443800.776 3 69 7 70.98787880.9878788
0.9372.6144550.8740.9580.196Cortex_T9CortexT9AT4G17340TIP2-2 0.762 5 75 3 80.98787880.9878788
0.8852.7608090.7700.8020.094Cortex_T9CortexT9AT5G49760AT5G497600.708 8 51 25 90.98787880.9878788
0.8603.1531480.7200.7880.140Cortex_T9CortexT9AT2G43050PME16 0.64826 5 54100.98787880.9878788
0.8892.8225210.7780.8690.238Cortex_T9CortexT9AT3G51730AT3G517300.63135 37 23120.98787880.9878788
0.8773.5501760.7540.9090.321Cortex_T9CortexT9AT3G48890MSBP2 0.58857 1 39130.98787880.9878788
0.8723.0860080.7440.8350.219Cortex_T9CortexT9AT4G15610AT4G156100.61641 14 43140.98787880.9878788
0.8542.8574610.7080.8390.131Cortex_T9CortexT9AT2G27920SCPL51 0.708 9 31 60150.98787880.9878788
0.8662.8490580.7320.8480.183Cortex_T9CortexT9AT3G18170AT3G181700.66521 34 46170.98787880.9878788
0.9312.5667510.8620.9820.304Cortex_T9CortexT9AT5G53370ATPMEPCRF0.67818 84 8180.98787880.9878788
In [36]:
# subset for endodermis
Endo_QC  <- subset(rc.integrated, celltype.anno %in% c("Quiescent Center", "Stem Cell Niche", "Endodermis"))
In [37]:
# pseudobulk of each stage of endodermis


  afm <- as.matrix(Endo_QC@assays$integrated@data)
  pooled_endo <- matrix(nrow=nrow(afm), ncol = 0)

  for (i in unique(Endo_QC@meta.data$consensus.time.group)) {
    m <- afm[,which(Endo_QC@meta.data$consensus.time.group==i)]
    pooled_endo <- cbind(pooled_endo, rowSums(m)/ncol(m))
  }
In [38]:
colnames(pooled_endo) <- unique(Endo_QC@meta.data$consensus.time.group)
In [39]:
(endo_sub_m <- pooled_endo[genes_to_plt_endo, c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9")])
A matrix: 91 × 10 of type dbl
T0T1T2T3T4T5T6T7T8T9
AT5G06200-0.3858394-0.39678862-0.46835782-0.46389492-0.48952583-0.345707311 0.373693602.56673485.0107853 9.13966786
AT4G02090-0.3510602-0.39418992-0.38203199-0.42705875-0.47492429-0.338104301 0.099410931.61658624.1614898 8.15244850
AT3G11550-0.4953639-0.46677592-0.55521079-0.55042610-0.57283147-0.212771666 1.132449694.46946997.1406041 9.23916043
AT2G39430-0.4245708-0.42423281-0.49306885-0.50669223-0.53260985-0.322867113 0.638631143.36315705.6825499 9.55358915
AT5G65020-0.7931151-0.78948578-0.32828818-0.31230876-0.28326219-0.018500135 0.558664511.74598472.0873044 3.96941827
AT1G44970-0.2927576-0.31995370-0.26834816-0.17713949-0.18024182-0.005917786 0.680628132.50765693.9772031 8.65848367
AT2G28671-0.3952874-0.36704201-0.34483836-0.38320250-0.27876517 0.370441468 1.463674434.51838936.2175832 8.02013733
AT2G27370-0.4853259-0.47650478-0.11488260-0.07551403 0.19024764 0.546233617 1.306345152.40881353.8982847 9.42446012
AT1G80640-0.1877883-0.16877722 0.28451788 0.47826073 0.90848674 1.246292123 1.487155411.92505632.3893394 5.39931515
AT5G44790-0.7297605-0.82119706-0.73355996-0.66759998-0.61724440-0.413716085-0.122520910.65390691.0491486 4.40288214
AT4G34050-2.3566686-1.79585068-0.47006990-0.19208806 0.33437955 0.864863010 1.918478761.86602911.4778715 8.44184172
AT3G24020-0.4565064-0.46963364-0.49882608-0.48197478-0.58610801-0.225118901 1.066134435.23682917.3932050 8.67938388
AT2G36100-0.6362937-0.79475947-0.93885657-0.94604437-0.83456318 0.228821138 3.807453818.60283709.6804359 9.96958029
AT4G37790-0.7497711-0.78208364-0.60697921-0.65552796-0.13524968 1.335909783 2.388845272.90372083.2024336-0.03346066
AT1G03850-1.2318407-1.25238601-1.30197303-1.40730057-1.44907875-0.968284819 0.181711603.18609624.4174776-0.42461356
AT4G13580-0.5008437-0.57179321-0.54536763-0.50029677-0.54254935-0.097553557 1.425156575.89594847.8413739 8.88636063
AT3G14280-0.8995567-0.89017261-0.90888272-0.93598856-0.88945990-0.381396618 0.475648092.43306863.4801323 0.92595224
AT3G03520-0.6705847-0.64697454-0.56757028-0.57162980-0.46632306-0.025015680 0.889153271.63410592.2816040 2.88187244
AT4G34230-1.2553710-1.31421382-1.14593246-1.04647799-0.24564486 1.600367913 2.941426742.68097702.2597036 0.83248303
AT2G15340-0.2702526-0.19758729 0.12811957 0.21321145 0.75248923 1.848805135 3.008392783.69978993.2691498 0.26131738
AT4G21620-0.0665043-0.08954689-0.05389634-0.06946120-0.07707639-0.010859435 0.133442660.51650650.6120284 0.14236826
AT5G08240-0.2973488-0.30150312-0.24060980-0.23140286-0.10279308 0.549758485 1.290668362.51594963.0404608 0.25374680
AT4G23493-0.1952053-0.11056667 0.20417212 0.24115336 0.37262324 0.548054281 0.909304541.47015601.4258435 0.83612281
AT3G09270-0.5222286-0.74368338-0.41671205 0.12180841 0.97123311 1.696658969 2.891366893.45899603.7708344 2.41603978
AT5G66390-0.7865327-0.81235975-0.66928313-0.66204141-0.27166507 1.859449235 5.506724278.52048259.2636907 9.82708009
AT5G42030-0.5148810-0.57885907-0.36773895-0.07448089 0.35071522 1.000217246 1.944576873.48635394.2439833 3.46502993
AT5G21090-0.6161858-0.67349504-0.37545738-0.30014663-0.15925541 0.094704127 0.657172001.45888601.5197383 2.44148386
AT3G06125-0.6865119-0.50920953 0.06696524 0.46182362 0.85619254 1.632832552 3.093233644.82479085.8022508 4.20825418
AT5G58375-0.7616663-0.59264250 0.17898453 0.34310756 0.55534713 1.018531430 1.892987343.19642803.5951370 3.81192220
AT5G25770-0.6668781-0.44818145 0.84302848 1.17726542 1.96982016 2.722521276 2.872635432.25931991.9620198 0.54683602
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
AT5G45200-0.094812531.5024485 4.16412767 3.330874408 2.27020679 0.93818090 0.17408611-0.08281854-0.1233102-0.14467148
AT3G54220 0.159976741.7797207 4.10576610 3.042229683 2.06278965 1.08856670 0.79181199 0.68605627 0.9144775 0.24598116
AT1G13280 0.268800041.0193887 2.85291382 2.291647806 1.48050830 0.31571107-0.24602163-0.48943928-0.5440299-0.35301278
AT5G63660 0.361959262.4154075 7.35964308 6.588208050 4.71766222 1.80170410 0.33312001-0.27383094-0.4750205-0.47575585
AT3G23730-0.350378872.5205206 6.61675109 5.173271016 2.37608381 0.15530188-0.36696652-0.46145889-0.5075597-0.44366898
AT1G65900-0.013023720.9910938 3.28294073 2.006943204 0.77087526-0.07406016-0.13684295-0.16673843-0.1641097-0.14115060
AT4G17970-0.028949931.2838070 3.27922272 2.098688152 1.06279669 0.22177797-0.02693181-0.14866521-0.1750839-0.18095174
AT4G39900 0.484999541.0967093 2.27547823 1.772786166 1.03698218 0.31039154-0.01100929-0.16717412-0.2689195-0.36687103
AT1G54580 1.982667503.6876237 5.06381552 3.528433605 1.52791878 0.02612911-0.48015255-0.76024700-0.8939658-0.81462618
AT5G55730 0.985387820.9087416 2.36710946 2.008857118 1.13156187 0.08978245-0.46166273-0.62392895-0.6873813-0.64471899
AT4G16265 1.266904151.8487911 2.33976340 1.759547253 1.40929677 0.85242534 0.45293427-0.07504988-0.1788466-0.20528832
AT3G54560 2.140117183.7699787 2.93119285-0.458639358-0.75691234-0.87250212-0.90766414-0.76493873-0.7761217-0.67776268
AT3G45980 1.715338553.9356025 3.48103668-0.004002006-0.30807872-0.54395603-0.60423954-0.38036369-0.4132243-0.51589831
AT5G23860-0.121362541.8044533 4.01882136 2.478177333 0.54894170-0.67886274-1.00407308-1.03882213-1.0139854-1.00233933
AT5G28640 1.182162012.7326165 2.21356819 0.829933580 0.11763119-0.10376573-0.05087782 0.10359300 0.1104304-0.12924947
AT5G07030 0.591395531.4820332 1.89946991 0.458414248-0.45850379-0.92097213-1.00536070-0.92542558-0.9346405-0.86130642
AT2G43360 1.234294042.2113871 1.79956254 0.971765788 0.35059114-0.05499681-0.23880023-0.29939148-0.3106121-0.13261472
AT2G22230 1.395373032.3420559 1.37626325 0.606205010 0.03332351-0.43526367-0.47140513-0.46982493-0.4716208-0.25754272
AT5G59910 1.499030902.6081995 2.45248608-0.333024403-0.54318185-0.60944705-0.54676720-0.31405661-0.3156692-0.57271143
AT1G14900 0.989335241.9633546 2.52267063 0.158046980-0.11178175-0.34593234-0.43476272-0.24899293-0.2775612-0.43776590
AT5G27670 0.662351041.3058391 1.74244736-0.475760718-0.56068768-0.58008121-0.66700418-0.53594857-0.5005500-0.57728421
AT3G05190 0.075190550.6095619 1.34615564 0.842070584 0.41259388 0.01469875-0.08129877-0.12531373-0.1425462-0.06831040
AT1G46264 0.560767691.5893468 1.64617315 0.813740282 0.20641275-0.13377767-0.16802978-0.15319769-0.1450894-0.11332716
AT4G21960 1.403922571.3224318-1.46562244-1.802413385-2.03752283-2.13481348-2.10916590-1.98248425-1.9587413-1.77702963
AT3G60530 0.633043011.7916014 1.29997529 0.254452569-0.48838273-0.67251493-0.66828068-0.63286692-0.6602692-0.54121124
AT2G45050 2.276948242.0452319 0.06479671-0.894146186-1.38110545-1.44507881-1.40493528-1.28920366-1.2623128-1.09599731
AT2G20515 3.212852952.7231023 0.16024779-0.342897328-0.65667461-0.71266069-0.69551494-0.60233201-0.6229676-0.53078236
AT5G48660 0.383662570.7355706 0.52066704 0.259425941 0.04593673-0.11679337-0.15231925-0.13947433-0.1311098-0.10041897
AT3G52960 1.535445562.2557511 1.09291420 0.449842604-0.06399537-0.36859733-0.51628803-0.44412095-0.4756124-0.37910350
AT3G56220 0.574377111.7519554 2.18585643 0.961780354 0.33810594-0.04135639-0.05803634-0.10004737-0.1296028-0.08310022
In [40]:
# quantile normalize

mat = endo_sub_m
mat2 = t(apply(mat, 1, function(x) {
    q10 = quantile(x, 0.1)
    q90 = quantile(x, 0.9)
    x[x < q10] = q10
    x[x > q90] = q90
    scale(x)
}))
colnames(mat2) = colnames(mat)
In [41]:
# side annotation with color to match umap

endo_sa = rowAnnotation(foo = anno_block(gp = gpar(fill = "#0000FF"),
        labels = c("Endodermis"), 
        labels_gp = gpar(col = "white", fontsize = 18)))
In [42]:
# genes to mark on side of heatmap

(endo_mat_for_mark <- data.frame(mat2) %>% 
 rownames_to_column("gene") %>%
 left_join(feature_names) %>% 
 mutate(index=dplyr::row_number()) %>%
select(Name, index) %>%
filter(Name %in% c("XTH16", "SCR", "MYB36", "CASP1", "CASP2", "CASP3", "CASP4")))
Joining, by = "gene"

A data.frame: 7 × 2
Nameindex
<chr><int>
CASP4 1
CASP2 3
CASP3 8
CASP113
MYB3638
SCR 63
XTH1666
In [43]:
# at - index of genes you want to mark
# labels - Names to show

endo_mark_anno = rowAnnotation(foo = anno_mark(at = endo_mat_for_mark$index, labels = endo_mat_for_mark$Name, labels_gp = gpar(col = "black", fontsize = 16)))
In [44]:
Endo_hm <- Heatmap(mat2, 
        col = colorRamp2(c(-1.5, 0, 1.5), 
                         c('blue','white','red')), 
                show_column_names = T,
                cluster_columns = F,
        cluster_rows=F,
                show_row_names = F, 
                   left_annotation=endo_sa,
                   right_annotation=endo_mark_anno,
               heatmap_legend_param = list(title_position="topcenter", title = "Expression", direction="horizontal"))

draw(Endo_hm, padding = unit(c(10, 10, 10, 10), "mm"), heatmap_legend_side = "top")
In [45]:
# cortex subset
Cor_QC  <- subset(rc.integrated, celltype.anno %in% c("Quiescent Center", "Stem Cell Niche", "Cortex"))
In [46]:
# pseudobulk of each stage of cortex


  afm <- as.matrix(Cor_QC@assays$integrated@data)
  pooled_cortex <- matrix(nrow=nrow(afm), ncol = 0)

  for (i in unique(Cor_QC@meta.data$consensus.time.group)) {
    m <- afm[,which(Cor_QC@meta.data$consensus.time.group==i)]
    pooled_cortex <- cbind(pooled_cortex, rowSums(m)/ncol(m))
  }
In [47]:
colnames(pooled_cortex) <- unique(Cor_QC@meta.data$consensus.time.group)
In [48]:
(cor_sub_m <- pooled_cortex[genes_to_plt_cortex, c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9")])
A matrix: 91 × 10 of type dbl
T0T1T2T3T4T5T6T7T8T9
AT3G18000 1.45629812.11251681.59977580.65169036 0.374898469-0.003056075-0.329839439-0.4234481576-0.50563275-0.50465766
AT1G68560 4.47875063.07393191.06525790.59338684 0.413303183-0.049724141-0.510957065-0.5707978573-0.67843653-0.71734785
AT2G24280 0.20428161.20571381.46894250.88514567 0.651492691 0.322703214 0.111291149 0.0201927247-0.05571095-0.08492299
AT3G09455 0.71826881.25545370.53972600.04164711-0.116544105-0.342577959-0.554016622-0.6115180633-0.62231791-0.64423775
AT3G52960 1.53907272.38812001.04583930.22814958 0.009500409-0.211504782-0.515399392-0.5318340513-0.60524844-0.61847596
AT3G54960 0.39110530.41952761.38323261.04689142 0.789351731 0.435904820-0.231103881-0.4848968987-0.65688367-0.67196142
AT2G34020 1.82899051.89941371.40749080.44504486 0.176480032-0.181292723-0.416326059-0.4290655006-0.44923508-0.45983640
AT2G20515 3.22310883.73410101.80976340.34749119-0.034612938-0.445260471-0.639877986-0.6416044804-0.64038185-0.64257177
AT2G45050 2.29168363.14132382.75922120.61320732 0.068032506-0.857371093-1.318017014-1.2871482382-1.35886754-1.36283422
AT5G05890 0.74111261.25630291.02613780.58056746 0.409808851 0.059864860-0.227912941-0.2462220700-0.26645606-0.26545003
AT4G34200 1.25783531.85474711.29523110.72060000 0.434128960 0.094309488-0.526250516-0.7076745100-0.90608364-0.98431235
AT2G21250 0.86820941.47872690.77936950.33277870 0.231478882 0.010877723-0.208840556-0.3855056251-0.51138725-0.56446705
AT1G09580 0.24321410.76711100.81357350.47703912 0.305800011 0.017599501-0.305777982-0.4180947460-0.48130615-0.49554806
AT5G22580 0.35728061.24605360.94983410.42652659 0.306227444 0.235021899 0.023086314-0.0392016839-0.09315772-0.10346438
AT5G50375 1.32890302.36827481.94698461.07165610 0.786521380 0.231828266-0.371225396-0.4855661367-0.53842904-0.54221664
AT3G56220 0.57867881.81679061.18758090.33771613 0.161842761 0.033954885-0.112077587-0.1195884118-0.14183495-0.15671290
AT5G48580 0.89476071.96983522.03389741.54457345 1.132927316 0.609677209-0.521814316-0.9220307072-1.29577248-1.37828877
AT1G17285 1.83836402.66028422.58202681.25017813 0.902320870 0.273571769-0.263060973-0.4623119022-0.75052265-0.79361576
AT5G14020 0.76344151.04246732.23494591.63653425 1.368368296 0.814412194-0.092144119-0.5120790514-0.80573170-0.85081814
AT5G67070 0.74603540.95453392.12934701.80099285 1.596632300 1.163589444 0.166611133-0.2132324163-0.51216865-0.56319274
AT1G64900 0.71300322.16086972.89276482.17706666 1.953479232 1.185478795 0.430668448 0.2666562114 0.06737647 0.04956654
AT3G19820 1.31337482.69440703.85289092.49157054 1.951764426 1.081909785-0.154132000-0.5637510564-0.90155171-0.94439512
AT3G60530 0.64923272.56221193.18225601.43130204 0.931737454 0.054155789-0.537388749-0.5977077868-0.61725570-0.60245794
AT5G35740 0.62106101.37465074.05896173.31610139 2.434884710 1.474137669 0.003824548-0.3222311457-0.60381767-0.69735277
AT1G21750 0.21767700.87412912.13059971.49084877 1.164035768 0.521270421-0.330455189-0.5377306545-0.74118485-0.71060408
AT5G66590 0.38152561.93125323.63278302.76766004 2.420213108 1.906832194 0.620413836 0.0028422463-0.49562324-0.58964600
AT5G02000-0.36635941.12853203.53461543.44047289 2.962183144 2.428352009 0.638198658-0.0001308083-0.35165516-0.41102049
AT5G12940 1.23208770.89287043.39198114.27726503 4.167349446 3.437580278 1.089410599-0.0940078867-0.87624082-1.03777900
AT1G70280 0.36617711.02699993.05969893.14198599 2.839073229 2.197381589 0.744949921 0.1863841017-0.23896929-0.30647609
AT4G03190 0.29368540.93642303.35227133.79672850 3.453015156 2.791831564 0.662759976-0.2789994430-0.87774736-0.97830939
⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮
AT1G13930-1.34439814-1.24318847-0.362714271 0.18743191 0.7804779 2.07667936 5.586901356.424534017.76967037.4227910
AT5G60660-1.60946952-1.53321725-0.165286365 0.71116914 1.4491902 1.91610217 2.950667114.133787954.43994625.5218999
AT3G01190-2.14310665-2.10293274-0.850661305-0.09404766 0.6804595 1.32325265 3.547075954.657169964.50878995.0916518
AT1G66725-0.86153200-0.84108351-0.641141255-0.52232552-0.4164361-0.03121431 1.239473881.616242221.94541011.6615306
AT3G14690-0.76544548-0.76214837 0.159928914 0.44840504 0.6226270 0.80850026 2.083156493.710827084.70130015.5741630
AT4G00330-0.53802052-0.57797100-0.492804074-0.39979331-0.3386538-0.21579669 0.565621161.018679921.51278261.1321281
AT2G39110-0.65418419-0.59779467-0.252061715-0.28854470-0.1966902-0.04370181 0.715981590.841232110.73194510.6763377
AT2G34500-1.37885076-1.33726846-0.471559210 0.17799980 0.7357248 1.21289159 3.569463594.315621373.93240524.5452128
AT4G37010-1.17838814-1.09931084-0.197258517 0.08263832 0.1385279 0.44394853 1.579759412.861839835.24373685.5496765
AT5G63600-1.46831718-1.37438446-0.929264150-0.86914562-0.7610614-0.39113386 1.090685482.100107172.95160763.1101740
AT3G57020-1.36634336-1.31987855 0.393026913 1.68484065 2.3100253 2.60635116 3.953099285.468856387.01133748.2339565
AT4G23400-1.70615084-1.70766325-0.830079621 0.03173150 0.6838932 1.34631921 3.418336405.259437456.62547568.0719090
AT5G15180-1.12361852-1.14517530-0.875267441-0.81117368-0.6915080-0.53899142 0.979323053.741487007.30933819.0931693
AT5G64100-2.26660195-2.24833884-2.136235952-2.12521916-2.0752466-2.03784264-1.402592720.422956504.83042347.2566697
AT2G31570-1.07351266-1.12706740-0.773450073-0.67693510-0.6763332-0.48356235-0.036580550.730216872.72682413.3040087
AT1G47480-0.64819059-0.72291597-0.315905773-0.11735721-0.0247899 0.16582862 0.916169431.516468302.33731752.5760710
AT4G02700-0.29910410-0.32640221 0.007837718 0.01921877 0.0912477 0.16037958 0.538936381.398658272.15295912.6115989
AT5G19240-0.91065722-1.01545920-0.801134604-0.77651091-0.6862805-0.58006298 0.598449432.453390735.96407817.6302250
AT4G09760-0.06271868-0.05907882-0.275104369-0.24630742-0.2520515-0.14603260 0.485905811.648858673.29821333.6686387
AT5G44480-0.63419551-0.65124105-0.565513115-0.53403700-0.5054886-0.45398743-0.031976030.727293742.24310233.3977857
AT5G44380-2.05053479-2.01778433-1.492034250-1.14733951-0.7285131-0.58064933 0.854409112.600321253.87429225.2728315
AT4G17340-1.72964851-1.71563588-1.561866232-1.57047345-1.4031728-1.33780702-0.275816291.762136835.35499817.6873168
AT5G49760-0.51732096-0.54572306-0.435694449-0.45147613-0.4578218-0.39668672-0.316127690.056268080.83253161.5094385
AT2G43050-0.62801972-0.63341185-0.585217330-0.60738140-0.6038916-0.54736117-0.281659450.211793271.85434843.2121493
AT3G51730-0.83410780-0.87195840-0.520902437-0.31879050-0.1702752-0.11411525 0.116207040.560925861.12560051.7320060
AT3G48890-0.42156266-0.49588032-0.195237803-0.04832097 0.1280329 0.09821212 0.497534181.194082381.84108262.9318223
AT4G15610-1.53735614-1.49278578-1.021188326-0.84381824-0.6965847-0.54446844 0.344624151.366969402.53542413.6972668
AT2G27920-0.35629574-0.38667154-0.317943310-0.24455367-0.2388745-0.25448165 0.114015770.918796532.73652704.2608756
AT3G18170-0.45648222-0.52115158-0.275310207-0.24616764-0.2391673-0.20533357 0.227822931.100840572.96644324.4635864
AT5G53370-0.58586651-0.58034723 0.004945644 0.46198472 0.8182913 1.07268713 2.760272574.170175255.87832247.4511394
In [49]:
# annotation bar for consensus time

col_fun <- brewer.pal(10,"Spectral")

names(col_fun) <- c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9")
col_fun

ha = HeatmapAnnotation(`Consensus Time Group` = c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"), col = list(`Consensus Time Group` = col_fun), show_legend = F)
T0
'#9E0142'
T1
'#D53E4F'
T2
'#F46D43'
T3
'#FDAE61'
T4
'#FEE08B'
T5
'#E6F598'
T6
'#ABDDA4'
T7
'#66C2A5'
T8
'#3288BD'
T9
'#5E4FA2'
In [50]:
# quantile normalize

mat = cor_sub_m
mat2 = t(apply(mat, 1, function(x) {
    q10 = quantile(x, 0.1)
    q90 = quantile(x, 0.9)
    x[x < q10] = q10
    x[x > q90] = q90
    scale(x)
}))
colnames(mat2) = colnames(mat)
In [51]:
# side annotation to match cortex colors

cortex_sa = rowAnnotation(foo = anno_block(gp = gpar(fill = "#82B6FF"),
        labels = c("Cortex"), 
        labels_gp = gpar(col = "black", fontsize = 18)))
In [52]:
# genes to label on side of heatmap for cortex

(cor_mat_for_mark <- data.frame(mat2) %>% 
 rownames_to_column("gene") %>%
 left_join(feature_names) %>% 
 mutate(index=dplyr::row_number()) %>%
select(Name, index) %>%
filter(Name %in% c("AT1G17285", "AT5G02000", "C/VIF2", "CYP72A15", "PER56", "PER69", "AT4G09760")))
Joining, by = "gene"

A data.frame: 7 × 2
Nameindex
<chr><int>
AT1G1728518
AT5G0200027
C/VIF2 60
CYP72A15 66
PER56 74
PER69 75
AT4G0976080
In [53]:
# at - index of genes you want to mark
# labels - Names to show

cor_mark_anno = rowAnnotation(foo = anno_mark(at = cor_mat_for_mark$index, labels = cor_mat_for_mark$Name, labels_gp = gpar(col = "black", fontsize = 16)))
In [54]:
# ['#d8b365','#f5f5f5','#5ab4ac']

Cortex_hm <- Heatmap(mat2, 
        col = colorRamp2(c(-1.5, 0, 1.5), 
                         c('blue','white','red')), 
                show_column_names = F,
                cluster_columns = F,
        cluster_rows=F,
                show_row_names = F, 
        show_heatmap_legend = F, 
        left_annotation=cortex_sa, 
        right_annotation=cor_mark_anno)

Cortex_hm
In [55]:
# text annotation for consensus time

ht = columnAnnotation(foo = anno_text(c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9"), rot = 0, just = "center", gp = gpar(fontsize = 16)))
In [56]:
options(repr.plot.width=12, repr.plot.height=10)


ht_list = ht %v% ha %v% Endo_hm %v% Cortex_hm

draw(ht_list, ht_gap = unit(0.2, "cm"), padding = unit(c(2, 2, 5, 10), "mm"), heatmap_legend_side = "bottom")
# grab heatmap as a grob to arrange in cowplot
hm_final <- grid.grabExpr(draw(ht_list, ht_gap = unit(0.2, "cm"), padding = unit(c(2, 2, 5, 10), "mm"), heatmap_legend_side = "bottom"))## bottom, left, top and right
In [57]:
# output heatmap as pdf

pdf("./supp_data/WT_Ground_tissue_heatmap.pdf", width = 12, height = 10)
draw(ht_list, ht_gap = unit(0.2, "cm"), padding = unit(c(2, 2, 5, 10), "mm"), heatmap_legend_side = "bottom") ## bottom, left, top and right
dev.off()
png: 2
In [58]:
DefaultAssay(rc.integrated) <- "integrated"


(SCR <- FeaturePlot(rc.integrated, features = "AT3G54220",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = T, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("SCR"))
In [59]:
(MYB36 <- FeaturePlot(rc.integrated, features = "AT5G57620",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = F, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("MYB36"))
In [60]:
(CASP <- FeaturePlot(rc.integrated, features = "AT2G36100",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = T, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("CASP1"))
In [61]:
options(repr.plot.width=8, repr.plot.height=6)
(Cor_1 <- FeaturePlot(rc.integrated, features = "AT5G02000",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = T, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("AT5G02000"))
In [62]:
options(repr.plot.width=8, repr.plot.height=6)
(Cor_2 <- FeaturePlot(rc.integrated, features = "AT5G64620",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = T, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("C/VIF2"))
In [63]:
options(repr.plot.width=8, repr.plot.height=6)
(Cor_3 <- FeaturePlot(rc.integrated, features = "AT4G09760",
    cols = c("grey", "red"), label=F, repel=F, pt.size = 0.3, order = T, min.cutoff = "q1", max.cutoff = "q99") + ggtitle("AT4G09760"))
In [64]:
plot_anno <- function(rc.integrated){
order <- c("Quiescent Center", "Stem Cell Niche", "Columella", "Lateral Root Cap", "Atrichoblast", "Trichoblast", "Cortex", "Endodermis", "Pericycle", "Phloem", "Xylem", "Procambium", "Unknown")
palette <- c("#9400D3","#DCD0FF", "#5AB953", "#BFEF45", "#008080", "#21B6A8", "#82B6FF", "#0000FF","#FF9900","#E6194B", "#9A6324", "#FFE119","#EEEEEE")
rc.integrated$celltype.anno <- factor(rc.integrated$celltype.anno, levels = order[sort(match(unique(rc.integrated$celltype.anno),order))])
color <- palette[sort(match(unique(rc.integrated$celltype.anno),order))]
p1 <- DimPlot(rc.integrated, reduction = "umap", group.by = "celltype.anno", cols=color) + ggtitle("Cell Type") + theme(plot.title = element_text(hjust = 0.5))
p2 <- DimPlot(rc.integrated, reduction = "umap", group.by = "time.anno", order = c("Maturation","Elongation","Meristem"),cols = c("#DCEDC8", "#42B3D5", "#1A237E")) + ggtitle("Developmental Stage") + theme(plot.title = element_text(hjust = 0.5))
p3 <- DimPlot(rc.integrated, reduction = "umap", group.by = "consensus.time.group", cols=brewer.pal(10,"Spectral")) + ggtitle("Consensus Time") + theme(plot.title = element_text(hjust = 0.5))
options(repr.plot.width=25, repr.plot.height=8)
gl <- lapply(list(p1, p2, p3), ggplotGrob)
gwidth <- do.call(unit.pmax, lapply(gl, "[[", "widths"))
gl <- lapply(gl, "[[<-", "widths", value = gwidth)
gridExtra::grid.arrange(grobs=gl, ncol=3)
}
In [65]:
options(repr.plot.width=28, repr.plot.height=6)
top_umaps <- plot_anno(rc.integrated)
In [66]:
options(repr.plot.width=24, repr.plot.height=18)

gene_umaps <- plot_grid(SCR, MYB36, CASP, Cor_1, Cor_2, Cor_3, ncol=3, align="hv")

gene_hm <- plot_grid(gene_umaps, hm_final, ncol=2, rel_widths = c(1.6, 1))
In [67]:
options(repr.plot.width=28, repr.plot.height=18)

plot_grid(top_umaps, gene_hm, ncol=1, rel_heights = c(1, 1.5))
In [68]:
ggsave("./supp_data/Endo_cortex_traj_combined.pdf",
  width = 28,
  height = 18)
In [69]:
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS/LAPACK: /home/tmnolan7/anaconda3/envs/r_3.6.1/lib/libopenblasp-r0.3.7.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] ggrepel_0.8.2        circlize_0.4.8       ComplexHeatmap_2.2.0
 [4] cowplot_1.0.0        future_1.17.0        RColorBrewer_1.1-2  
 [7] Seurat_3.1.5         forcats_0.5.0        stringr_1.4.0       
[10] dplyr_0.8.5          purrr_0.3.3          readr_1.3.1         
[13] tidyr_1.0.2          tibble_3.0.1         ggplot2_3.3.0       
[16] tidyverse_1.3.0     

loaded via a namespace (and not attached):
  [1] Rtsne_0.15           colorspace_1.4-1     rjson_0.2.20        
  [4] ellipsis_0.3.0       ggridges_0.5.2       IRdisplay_0.7.0     
  [7] GlobalOptions_0.1.1  base64enc_0.1-3      fs_1.4.1            
 [10] clue_0.3-57          rstudioapi_0.11      farver_2.0.3        
 [13] leiden_0.3.3         listenv_0.8.0        npsurv_0.4-0        
 [16] fansi_0.4.1          lubridate_1.7.8      xml2_1.3.0          
 [19] codetools_0.2-16     splines_3.6.1        lsei_1.2-0          
 [22] IRkernel_1.1         jsonlite_1.6.1       broom_0.5.5         
 [25] ica_1.0-2            cluster_2.1.0        dbplyr_1.4.2        
 [28] png_0.1-7            uwot_0.1.8           sctransform_0.2.1   
 [31] compiler_3.6.1       httr_1.4.1           backports_1.1.7     
 [34] assertthat_0.2.1     Matrix_1.2-18        lazyeval_0.2.2      
 [37] cli_2.0.2            htmltools_0.4.0      tools_3.6.1         
 [40] rsvd_1.0.3           igraph_1.2.5         gtable_0.3.0        
 [43] glue_1.4.1           RANN_2.6.1           reshape2_1.4.3      
 [46] rappdirs_0.3.1       Rcpp_1.0.4.6         cellranger_1.1.0    
 [49] vctrs_0.2.4          gdata_2.18.0         ape_5.3             
 [52] nlme_3.1-145         lmtest_0.9-37        globals_0.12.5      
 [55] rvest_0.3.5          lifecycle_0.2.0      irlba_2.3.3         
 [58] gtools_3.8.2         MASS_7.3-51.5        zoo_1.8-8           
 [61] scales_1.1.1         hms_0.5.3            parallel_3.6.1      
 [64] gridExtra_2.3        reticulate_1.15      pbapply_1.4-2       
 [67] stringi_1.4.3        caTools_1.18.0       shape_1.4.4         
 [70] repr_1.1.0           rlang_0.4.6          pkgconfig_2.0.3     
 [73] bitops_1.0-6         evaluate_0.14        lattice_0.20-41     
 [76] ROCR_1.0-7           labeling_0.3         patchwork_1.0.0.9000
 [79] htmlwidgets_1.5.1    tidyselect_1.0.0     RcppAnnoy_0.0.16    
 [82] plyr_1.8.6           magrittr_1.5         R6_2.4.1            
 [85] gplots_3.0.3         generics_0.0.2       pbdZMQ_0.3-3        
 [88] DBI_1.1.0            pillar_1.4.3         haven_2.2.0         
 [91] withr_2.2.0          fitdistrplus_1.0-14  survival_3.1-11     
 [94] tsne_0.1-3           future.apply_1.4.0   modelr_0.1.6        
 [97] crayon_1.3.4         uuid_0.1-4           KernSmooth_2.23-16  
[100] plotly_4.9.2.1       GetoptLong_0.1.8     readxl_1.3.1        
[103] data.table_1.12.8    reprex_0.3.0         digest_0.6.25       
[106] munsell_0.5.0        viridisLite_0.3.0   
In [ ]: